﻿<%@ Page Language="C#" MasterPageFile="~/Search/MasterPage.master" AutoEventWireup="true" CodeFile="Apply.aspx.cs" Inherits="Search_HR_Apply" Title="无标题页" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';
        var ToDiv = function(value){
            return String.format('<>{0}</div>',value);
        }
        var Shenhe = function (value) {
            if(value==0){return String.format(template,'red', '未审');}
            if(value==1){return String.format(template,'green', '批准');}
            if(value==2){return String.format(template,'blue', '禁止');}
        }
    </script>
 
    <ext:Store ID="Store1" OnRefreshData="Store1_OnRefreshData" runat="server">
    <Reader>
        <ext:JsonReader ReaderID="id">
            <Fields>
                <ext:RecordField Name="id" Type="Int"></ext:RecordField>
                <ext:RecordField Name="rep_username" Type="String"></ext:RecordField>
                <ext:RecordField Name="rep_userdeptname" Type="String"></ext:RecordField>
                <ext:RecordField Name="reason" Type="String"></ext:RecordField>
                <ext:RecordField Name="counttimes" Type="Int"></ext:RecordField>
                <ext:RecordField Name="hr_status" Type="Int"></ext:RecordField>
                <ext:RecordField Name="dept_status" Type="Int"></ext:RecordField>
                <ext:RecordField Name="boss_status" Type="Int"></ext:RecordField>
                <ext:RecordField Name="apply_username" Type="String"></ext:RecordField>
                <ext:RecordField Name="apply_userdeptname" Type="String"></ext:RecordField>
                <ext:RecordField Name="bossnod" Type="Int"></ext:RecordField>
                <ext:RecordField Name="usertime" Type="Date"></ext:RecordField>
                
            </Fields>
        </ext:JsonReader>
        
    </Reader>
    <AutoLoadParams>
         <ext:Parameter Name="start" Mode="Raw" Value="0" />
         <ext:Parameter Name="limit" Mode="raw" Value="10" />
        </AutoLoadParams> 
    </ext:Store>
    <ext:GridPanel   runat="server" Height="500" StoreID="Store1" ID="companyGridpanel" Frame="true">
        <ColumnModel>
            <Columns>
                <ext:Column ColumnID="rep_username" DataIndex="rep_username" Header="档案员工"></ext:Column>
                <ext:Column ColumnID="rep_userdeptname" DataIndex="rep_userdeptname" Header="档案部门"></ext:Column>
                 
                <ext:Column ColumnID="hr_status" DataIndex="hr_status" Header="人事领导">
                    <Renderer Fn="Shenhe" />
                </ext:Column>
                <ext:Column ColumnID="dept_status" DataIndex="dept_status" Header="部门领导">
                    <Renderer Fn="Shenhe" />
                </ext:Column>
                <ext:Column ColumnID="boss_status" DataIndex="boss_status" Header="公司领导">
                    <Renderer Fn="Shenhe" />
                </ext:Column>
                <ext:Column ColumnID="apply_username" DataIndex="apply_username" Header="申请人"></ext:Column>
                <ext:Column ColumnID="apply_userdeptname" DataIndex="apply_userdeptname" Header="申请人部门"></ext:Column>
                <ext:Column ColumnID="reason" DataIndex="reason" Header="查看原因">                   
                </ext:Column> 
                <ext:Column ColumnID="bossnod" DataIndex="bossnod" Header="审核">
                    <Renderer Fn="Shenhe" />
                </ext:Column>
                
                <ext:CommandColumn Width="180" ColumnID="AllowToShow">
                    <Commands>  
                        <ext:GridCommand Icon="DoorOpen" Text="详细" CommandName="detailshow">
                        <ToolTip Title="详细" />
                        </ext:GridCommand>
                        <ext:GridCommand Icon="ApplicationOsxGo" Text="批准" CommandName="allow">
                        <ToolTip Title="批准" />                         
                        </ext:GridCommand>
                        <ext:GridCommand Icon="ApplicationOsxError" Text="禁止" CommandName="unallow">
                        <ToolTip Title="禁止" />
                        </ext:GridCommand>
                    </Commands>
                </ext:CommandColumn>
            </Columns>
        </ColumnModel> 
        <BottomBar>
            <ext:PagingToolBar 
                ID="PagingToolBar1" 
                runat="server" 
                PageSize="10" 
                StoreID="Store1" 
                />
        </BottomBar>
        <AjaxEvents>
            <Command OnEvent="Allow">
                <ExtraParams>
                    <ext:Parameter Mode="Raw" Name="id" Value="record.data.id"></ext:Parameter>
                    <ext:Parameter Mode="Raw" Name="reason" Value="record.data.reason"></ext:Parameter>
                    <ext:Parameter Mode="Raw" Name="cmd" Value="command"></ext:Parameter>
                </ExtraParams>
            </Command>
        </AjaxEvents>
    </ext:GridPanel>
</asp:Content>

